package edu.uwm.capstone.util;

import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.text.ParseException;

public class NumberUtil
{
  private static DecimalFormat TEST_FORMAT = getDecimalFormat("0000.00");

  public static DecimalFormat getDecimalFormat(String paramString)
  {
    NumberFormat localNumberFormat = NumberFormat.getNumberInstance();
    if ((localNumberFormat instanceof DecimalFormat))
    {
      DecimalFormat localDecimalFormat = (DecimalFormat)localNumberFormat;
      localDecimalFormat.applyPattern(paramString);
      return localDecimalFormat;
    }
    return new DecimalFormat(paramString);
  }

  public static boolean isNumber(CharSequence paramCharSequence)
  {
    try
    {
      TEST_FORMAT.parse(paramCharSequence.toString());
      return true;
    }
    catch (ParseException localParseException)
    {
    }
    return false;
  }
}
